from users import user_bp
from flask import make_response,request


@user_bp.route('/cookie')
def set_cookie():
    '''设置cookie'''
    resp=make_response('set cookie ok')
    # max_age设置cookie有效期
    resp.set_cookie('username','weikui',max_age=3600)
    return resp

@user_bp.route('/get_cookie')
def get_cookie():
    '''获取cookie'''
    resp=request.cookies.get('username')
    return resp

@user_bp.route('/del_cookie')
def del_cookie():
    '''删除cookie'''
    resp=make_response('删除成功')
    resp.delete_cookie('username')
    return resp